<template>
  <view class="rich-container" > 
    <rich-text :nodes="richTextContent" class="rich-text-content" />
  </view>

</template>
<script>
export default {
  data() {
    return {
      richTextContent: "",
    }
  },
    onLoad() {
    this.fetchNews();
  },
  methods: {
     async fetchNews() {
      try {
        const res = await uni.request({
          url: 'http://chaoxiang.scoringchina.com/index/api/aboutus',
          method: 'GET'
        });
        if(res && res.data && res.data.code === 1) {
          console.log(res.data.data);
          this.richTextContent = res.data.data.content || "";
        } else {
          console.error('获取数据失败', res);
        }
      } catch (error) {
        console.error('请求异常', error);
      }
    },
    goBack() {
      uni.navigateBack({
        delta: 1
      })
    }
  }
}
</script>
<style>
.rich-container {
    padding: 0;
}
/* 富文本容器 */
.rich-container ::v-deep p {
  text-align: center; /* 居中 */
  margin: 0;
  padding: 0;
}

.rich-container ::v-deep img {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}
</style>